package lx.prac.thymeleaf.controller;

import lx.prac.common.DateUtils;
import lx.prac.thymeleaf.vo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 *
 */
@Controller
public class IndexController {
    @RequestMapping("/")
    public String index(HttpServletRequest request){
        List<User> list = new ArrayList<>();
        list.add(new User(5,"小明"));
        list.add(new User(55,"小红"));
        request.setAttribute("aa","aa test");
        request.setAttribute("list",list);

        request.setAttribute("today", DateUtils.getYyyyMMdd());
        return "index";
    }
}
